import Main from '../views/Main.vue';

export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: '智能考勤管理'
    },
    component: resolve => {
        require(['../views/login/login.vue'], resolve);
    }
};

export const page404 = {
    path: '/*',
    name: 'error_404',
    meta: {
        title: '404-页面不存在'
    },
    component: resolve => {
        require(['../views/error_page/404.vue'], resolve);
    }
};

export const page401 = {
    path: '/401',
    meta: {
        title: '401-权限不足'
    },
    name: 'error_401',
    component: resolve => {
        require(['../views/error_page/401.vue'], resolve);
    }
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500-服务端错误'
    },
    name: 'error_500',
    component: resolve => {
        require(['../views/error_page/500.vue'], resolve);
    }
};

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        {
            path: 'home',
            title: '首页',
            name: 'home_index',
            component: resolve => { require(['../views/home/home.vue'], resolve); }
        },
        {
            path: 'ownspace',
            title: '个人中心',
            name: 'ownspace_index',
            component: resolve => { require(['../views/home/own-space.vue'], resolve); }
        },
        {
            path: 'detail',
            title: '考勤查询',
            name: 'detail_index',
            component: resolve => { require(['../views/attendance/components/userDetail.vue'], resolve); }
        },
    ]
};


// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    // {
    //     path: '/view',
    //     icon: 'ios-compose-outline',
    //     name: 'view',
    //     title: '界面管理',
    //     component: Main,
    //     children: [
    //         {
    //             path: 'custom',
    //             name: 'custom',
    //             title: '分组卡片配置',
    //             component: resolve => {
    //                 require(['../views/view/customview.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'logo',
    //             name: 'logo',
    //             title: '实时界面配置',
    //             component: resolve => {
    //                 require(['../views/view/logo.vue'], resolve);
    //             }
    //         },
    //     ]
    // },
    {
        path: '/user',
        icon: 'ios-people-outline',
        name: 'user',
        title: '用户管理',
        component: Main,
        children: [
            // {
            //     path: 'staff',
            //     name: 'staff',
            //     title: '员工管理',
            //     component: resolve => { require(['../views/user/staff.vue'], resolve); }
            // },
            {
                path: 'student',
                name: 'student',
                title: '学员管理',
                component: resolve => { require(['../views/user/newStudent.vue'], resolve); }
            },
            // {
            //     path: 'guest',
            //     name: 'guest',
            //     title: '访客管理',
            //     component: resolve => { require(['../views/user/guest.vue'], resolve); }
            // },
            // {
            //     path: 'vip',
            //     name: 'vip',
            //     title: 'VIP 管理',
            //     component: resolve => { require(['../views/user/vip.vue'], resolve); }
            // },
            // {
            //     path: 'stranger',
            //     name: 'stranger',
            //     title: '陌生人管理',
            //     component: resolve => { require(['../views/user/stranger.vue'], resolve); }
            // },
            // {
            //     path: 'depart',
            //     title: '部门管理',
            //     name: 'depart',
            //     component: resolve => { require(['../views/user/departSetting.vue'], resolve); }
            // },
            {
                path: 'photoLibrary',
                name: 'photoLibrary',
                title: '底库管理',
                component: resolve => { require(['../views/user/photoLibrary.vue'], resolve); }
            },
        ]
    },
    {
        path: '/record',
        icon: 'ios-list-outline',
        name: 'record',
        title: '历史记录',
        access: [1, 3],
        component: Main,
        children: [
            {
                path: 'studentRecord',
                title: '学员记录',
                name: 'studentRecord',
                component: resolve => { require(['../views/record/student.vue'], resolve); }
            },
            // {
            //     path: 'user',
            //     title: '用户记录',
            //     name: 'userRecord',
            //     component: resolve => { require(['../views/record/user.vue'], resolve); }
            // },
            {
                path: 'stranger',
                title: '陌生人记录',
                name: 'strangerRecord',
                component: resolve => { require(['../views/record/stranger.vue'], resolve); }
            }
        ]
    },
    // {
    //     path: '/conference',
    //     icon: 'ios-world-outline',
    //     name: 'conference',
    //     title: '会议管理',
    //     component: Main,
    //     children: [
    //         {
    //             path: 'meeting',
    //             name: 'meeting',
    //             title: '会议列表',
    //             component: resolve => {
    //                 require(['../views/meeting/meeting.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'participant',
    //             name: 'participant',
    //             title: '参会人员',
    //             component: resolve => {
    //                 require(['../views/meeting/participant.vue'], resolve);
    //             }
    //         },
    //         {
    //             path: 'invite',
    //             name: 'invite',
    //             title: '邀请函管理',
    //             component: resolve => {
    //                 require(['../views/meeting/invite.vue'], resolve);
    //             }
    //         }
    //     ]
    // },
    // {
    //     path: '/guard',
    //     icon: 'ios-unlocked-outline',
    //     name: 'guard',
    //     title: '门禁管理',
    //     component: Main,
    //     children: [
    //         {
    //             path: 'device',
    //             title: '门禁设置',
    //             name: 'guardDevice',
    //             component: resolve => { require(['../views/guard/device.vue'], resolve); }
    //         }
    //     ]
    // },
    {
        path: '/attendance',
        icon: 'ios-calendar-outline',
        name: 'attendance',
        title: '考勤管理',
        access: [1, 2, 3],
        component: Main,
        children: [
            {
                path: 'classgrade',
                title: '班级管理',
                name: 'classgrade',
                component: resolve => { require(['../views/attendance/classgrade.vue'], resolve); }
            },
            // {
            //     path: 'scheduleStat',
            //     title: '班级课表',
            //     name: 'scheduleStat',
            //     component: resolve => { require(['../views/attendance/scheduleStatistics.vue'], resolve); }
            // },
            {
                path: 'classAttendanceStat',
                title: '班级考勤',
                name: 'classAttendanceStat',
                component: resolve => { require(['../views/attendance/classAttendanceStat.vue'], resolve); }
            },
            // 员工暂时注释
            // {
            //     path: 'stat',
            //     title: '员工考勤统计',
            //     name: 'attendanceStat',
            //     component: resolve => { require(['../views/attendance/attendanceStatistics.vue'], resolve); }
            // },
            // {
            //     path: 'setting',
            //     title: '考勤设置',
            //     name: 'attendanceSetting',
            //     component: resolve => { require(['../views/attendance/setting.vue'], resolve); }
            // }
        ]
    },
    // {
    //     path: '/track',
    //     icon: 'ios-game-controller-b-outline',
    //     name: 'track',
    //     title: '布控管理',
    //     access: [1],
    //     component: Main,
    //     children: [
    //         {
    //             path: 'search2',
    //             title: '人员追踪',
    //             name: 'trackSearch2',
    //             component: resolve => { require(['../views/track/search2.vue'], resolve); }
    //         },
    //         {
    //             path: 'ipcStatistics',
    //             title: 'IPC统计',
    //             name: 'ipcStatistics',
    //             component: resolve => { require(['../views/track/ipcStatistics.vue'], resolve); }
    //         },
    //     ]
    // },

    {
        path: '/system',
        icon: 'ios-gear-outline',
        name: 'system',
        title: '系统设置',
        access: [1],
        component: Main,
        children: [
            {
                path: 'ipc',
                title: '设备管理',
                name: 'ipc',
                component: resolve => { require(['../views/system/ipcSetting.vue'], resolve); }
            },
            {
                path: 'group',
                title: '集团管理',
                name: 'group',
                component: resolve => { require(['../views/system/group.vue'], resolve); }
            },
            {
                path: 'campus',
                title: '校区管理',
                name: 'campus',
                component: resolve => { require(['../views/system/campus.vue'], resolve); }
            },
            // {
            //     path: 'classroom',
            //     title: '教室管理',
            //     name: 'classroom',
            //     component: resolve => { require(['../views/attendance/classroom.vue'], resolve); }
            // },
            {
                path: 'account',
                title: '账号管理',
                name: 'account',
                component: resolve => { require(['../views/system/accountSetting.vue'], resolve); }
            },
            // {
            //     path: 'localSetting',
            //     title: '服务配置',
            //     name: 'localSetting',
            //     component: resolve => { require(['../views/system/localSetting.vue'], resolve); }
            // }
        ]
    }
];

export const routers = [
    loginRouter,
    otherRouter,
    ...appRouter,
    page500,
    page401,
    page404,
];
